<template>
  <section class="wrapper">
    <myHeader :obj="myObj" @events="events(eventnun)"></myHeader>
    <main>
      <subject>
        <span slot="title">{{listDate.Title}}</span>
        <span slot="type">一对一约见</span>
        <span slot="money">{{listDate.Money.toFixed(2)}}</span>
      </subject>
      <myProgress :level="level"></myProgress>
      <myBigIcon></myBigIcon>
      <myField2 :information="information"></myField2>
      <div class="finished">{{this.$route.query.switch?"订单已关闭":"已完成约见"}}</div>
      <div v-if="listDate.Content || listDate.Tallys">
        <div class="myComment" v-if="!this.$route.query.switch">
          <h4 class="titleH4">我的评论</h4>
          <p>{{listDate.Content}}</p>
        </div>
        <div class="starWrap"  v-if="!this.$route.query.switch">
        <myStar @changeStar="changeStar" :iNow="listDate.Level" :ischeck="false"></myStar>
        </div>
        <div class="impress"  v-if="!this.$route.query.switch">对{{listDate.Name}}的印象（最多三个）：</div>
        <div class="labels"  v-if="!this.$route.query.switch">
          <myLabel v-for="item in listDate.Tallys">{{item}}</myLabel>
        </div>
      </div>
    </main>
  </section>
</template>
<script>
import myHeader from './base/myHeader';
import subject from './base/subject';
import myProgress from './base/myProgress';
import myBigIcon from './base/myBigIcon';
import myField2 from './base/myField2';
import myStar from './base/myStar';
import myLabel from './base/myLabel';
import hgjSkip from '../assets/js/hgjSkip';
import API from '../assets/js/asktoses';
import { fetch } from '../assets/api';
export default {
  data () {
    return {
      myObj:{
        type: 2,
        text: '约见详情'
      },
      level: 4,
      comlist:{},
      AskToSeeId:this.$route.query.AskToSeeId,
      listDate:{},
      loginData:null,
      eventnun:this.$route.query.num,
      information:[
        {
          title:"行家",
          des:"2018-04-08",
          inputs:false
        },
        {
          title:"开始时间",
          des:"2018-04-28",
          inputs:false
        },
        {
          title:"结束时间",
          des:"2018-04-28",
          inputs:false
        },
        {
          title:"联系电话",
          des:"156********",
          inputs:false
        },
        {
          title:"约见地点",
          des:"中国广东省广州市美博会F栋4楼",
          inputs:false
        },
        {
          title:"订单号",
          des:"201803141533141",
          inputs:false
        },
      ],
    }
  },
  created() {
    hgjSkip.skip().then(res =>{
      this.loginData = res;
      console.log(this.$route.query.num)
      this.eventnun = this.eventnun?this.eventnun:1
      this.experinformation();
    })
  },
  methods: {
    events(i) {
      if (i == 2) {
        history.back();
      } else {
        this.$router.push({path:"/"})
      }
    },
    changeStar(i) {
      console.log(i);
    },
    async commentlist(){
      const res = await fetch(API.getcommentlist,{
        ...this.loginData[1],
        PostMesssageDetailId: this.AskToSeeId
      });
      this.comlist = res.Result.Comments
    },
    //获取行家信息
    async experinformation(){
      const res = await fetch(API.getOrderList,{
        ...this.loginData[0],
        ...this.loginData[1],
        AppointmentOrderNo:this.$route.query.AppointmentOrderNo
      });
      this.listDate = res.Result;
      this.information = [
        {
          title:"行家",
          des:this.loginData[1].OpenId==this.listDate.ExpertOpenId?this.listDate.Name:this.listDate.ExpertName,
          inputs:false
        },
        {
          title:"开始时间",
          des:this.listDate.SMeetUpTime,
          inputs:false
        },
        {
          title:"结束时间",
          des:this.listDate.EMeetUpTime,
          inputs:false
        },
        {
          title:"联系电话",
          des:this.loginData[1].OpenId==this.listDate.ExpertOpenId?this.listDate.AppointmentPhone:this.listDate.Phone,
          inputs:false
        },
        {
          title:"约见地点",
          des:this.listDate.Location,
          inputs:false
        },
        {
          title:"订单号",
          des:this.listDate.AppointmentOrderNo,
          inputs:false
        },
      ]
    },
  },
  components: {
    myHeader,
    subject,
    myProgress,
    myBigIcon,
    myField2,
    myStar,
    myLabel
  }
}
</script>
<style lang="less" scoped>
  .wrapper {
    width: 3.75rem;
    height: 100%;
    main {
      width: 100%;
      height: 100%;
      padding-top: .44rem;
      position: absolute;
      top: 0;
      left: 0;
      overflow-y: auto;
      box-sizing: border-box;
      .labels {
        padding: .12rem .15rem;
        margin-bottom: .4rem;
        overflow: hidden;
      }
      .impress {
        color: #39393D;
        font-size: .16rem;
        padding: 0 .15rem;
        font-weight: 500;
        padding-bottom: .12rem;
      }
      .starWrap {
        padding: .14rem .15rem;
      }
      .myComment {
        background: white;
        padding: .12rem .15rem;
        box-sizing: border-box;
        .titleH4 {
          font-size: .14rem;
          color: #000;
          margin: 0;
          margin-bottom: .12rem;
        }
        p {
          font-size: .14rem;
          line-height: .17rem;
          color: #828282;
        }
      }
      .finished {
        width: 100%;
        height: .57rem;
        line-height: .57rem;
        color: #555555;
        font-size: .2rem;
        border-top: .01rem solid #E5E5E5;
        background: white;
        text-align: center;
        margin-bottom: .1rem;
      }
      
    }
  }
</style>
